package org.sfx.util

import org.sfx.io.IndentPrintWriter
import org.sfx.rich.Enrich._
import java.io.PrintWriter
import javafx.scene.Node

import scala.collection.JavaConverters._

object GenImplicits {
  def main(args: Array[String]): Unit = {
    val out = new IndentPrintWriter(new PrintWriter(System.out))
    out.indentSize = 2
    
    var readableProperties: List[(String, String)] = Nil
    var writableProperties: List[(String, String)] = Nil
    
    for (method <- classOf[Node].getDeclaredMethods) {
      println("--> M: " + method.getName)
      println("--> " + method.getGenericReturnType())
      println("--> " + method.getGenericReturnType().scalaString)
    }
    
    out.println("implicit def enrichHasBlendModeProperty(")
    out.indent {
      out.indent {
        out.println("underlying: {def blendModeProperty(): ObjectProperty[BlendMode]}) = new {")
      }
      out.println("def blendMode_=(value: BlendMode) = underlying.blendModeProperty().set(value)")
    }
    out.println("}")
    out.println()
  
    out.println("implicit def enrichHasBoundsInLocalProperty(")
    out.indent {
      out.indent {
        out.println("underlying: {def boundsInLocalProperty(): ReadOnlyObjectProperty[Bounds]}) = new {")
      }
      out.println("def boundsInLocal = underlying.boundsInLocalProperty().get()")
    }
    out.println("}")
  }
}